// max: 9999
export default class CNumber {
    constructor () {
        // ...
    }

    private random () {
        return Number(Math.random().toFixed(4)) * 10000
    }

    smallThen (num: number) {
        let result = 0
        do {
            result = Math.ceil(this.random() % num)
        } while (result > num)

        return result
    }

    largeThen (num: number) {
        return Math.ceil(this.random() + num)
    }

    rangeIn (sm: number, lg: number) {
        let result = 0
        do {
            result = this.random()
        } while (result > lg || result < sm)

        return Math.ceil(result)
    }

    multiThen (originNum: number, maxMulti: number) {
        const multi = this.smallThen(maxMulti)
        return Math.ceil(originNum * multi)
    }
}
